package com.heg.bk.dao.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.springframework.stereotype.Repository;

import com.heg.bk.dao.MybatisBaseDao;


/**
 * mybatis常用方法封装(数据实现层)
 * @author 邓绪招
 * @time 2016-04-10
 * @version 1.1
 */
@Repository("mybatisBaseDaoImpl")
public class MybatisBaseDaoImpl extends SqlSessionDaoSupport implements MybatisBaseDao {
	
	@Resource(name = "mybatisSessionFactory")
	public void setSqlSessionFactory(SqlSessionFactory sqlSessionFactory) {
		super.setSqlSessionFactory(sqlSessionFactory);
	}

	public Integer insert(Object object, String mapperId) {
		return this.getSqlSession().insert(mapperId, object);
	}

	public Integer insert(Map<String, String> obj, String mapperId) {
		return this.getSqlSession().insert(mapperId, obj);
	}

	public Integer delete(String objId, String mapperId) {
		return this.getSqlSession().delete(mapperId, objId);
	}

	public Object selectOne(String objId, String mapperId) {
		return this.getSqlSession().selectOne(mapperId, objId);
	}
	
	public List selectList(Object obj, String mapperId) {
		return this.getSqlSession().selectList(mapperId, obj);
	}

	public Object selectList(String params, String mapperId) {
		return this.getSqlSession().selectList(mapperId, params);
	}

	public Object selectMap(String params, String mapperId) {
		return this.getSqlSession().selectMap(mapperId, params);
	}

	public Integer update(Object obj, String mapperId) {
		return this.getSqlSession().update(mapperId, obj);
	}

}
